package project.newCode.surfaces;
import java.util.ArrayList;


import project.hulpPakket.*;
import project.newCode.Hitrecord;
import project.newCode.Ray;
import project.newCode.materials.Material;
import project.newCode.transformations.*;
// This class is intended to contain individual Surfaces as well as one master Surface group containing the entire Scene.
// Notice the difference between the Scene and Surface classes, the Scene class is intended to form the scene from 
// individual objects using transformations, 
public abstract class Surface implements Hittable {
	private Material m;
	private Matrix4f transformation;
	public Surface() {
		this.m = null;
		this.transformation = new Translation(new Vector3f(0,0,0));
	}
	public Surface(Material m1){
		this.m = m1;
		this.transformation = new Translation(new Vector3f(0,0,0));
	}
	/* (non-Javadoc)
	 * @see project.newCode.surfaces.Hittable#hit(project.newCode.Ray, double, double, project.newCode.Hitrecord)
	 */
	@Override
	public abstract boolean hit(Ray hittingray, double t0, double t1, Hitrecord rec);
	/* (non-Javadoc)
	 * @see project.newCode.surfaces.Hittable#boundingbox()
	 */
	@Override
	public abstract Box boundingbox();
	public abstract Surface surfaceClone();
	public Material getMaterial() {
		return m;
	}
	public void setMaterial(Material m) {
		this.m = m;
	} 
	public void setMaterialProperties(Hitrecord rec){
		rec.cs = m.getCs();
		//rec.cr = trec.cr;
		rec.cr = m.getCr(rec.tex);
		rec.phongexp = m.getPhongExp();
		rec.material = m;
	}
	public ArrayList<Surface> getSurfaceList() {
		ArrayList<Surface> s = new ArrayList<Surface>();
		s.add(this);
		return s;
	}
	public Matrix4f getTransformation() {
		return transformation;
	}
	public Surface Transform(Matrix4f transformation, Matrix4f inverse) {
		this.transformation = transformation;
		return this;
	}
}
